package com.kindness.frate.animate;

import android.animation.ValueAnimator;

/**
 * Created by Administrator on 2017/7/19 0019.
 */
public class AnimateUtils {

    public ValueAnimator valueAnimateChange(float start, float end, int duration, final ValueAnimateListener valueAnimateListener) {
        if(duration < 0){
            return null;
        }
        ValueAnimator animator = ValueAnimator.ofFloat(start, end);
        animator.addUpdateListener(animation -> {
            if(valueAnimateListener != null){
                valueAnimateListener.animte(animation);
            }
        });
        animator.setDuration(duration);
        animator.start();
        return animator;
    }

    public interface ValueAnimateListener {
        void animte(ValueAnimator animation);
    }

}
